package main

import (
	"fmt"
	"sync"
)

var wg = sync.WaitGroup{}
var mx = sync.Mutex{}
var num = 0

func main() {
	for i := 0; i < 100; i++ {
		wg.Add(1)
		go func() {
			defer wg.Done()
			mx.Lock()
			num++
			mx.Unlock()
		}()
	}
	wg.Wait()
	fmt.Println(num)

}
